<template>
  <div class="manage-container">
    <!-- 顶部导航 -->
    <TopBar />

    <div class="manage-content">
      <!-- 侧边栏导航 -->
      <div class="sidebar">
        <div class="sidebar-header">
          <h2>管理员控制台</h2>
        </div>
        <el-menu
          :default-active="activeMenu"
          class="sidebar-menu"
          background-color="#1f1b24"
          text-color="#b0bec5"
          active-text-color="#00aeff"
          router
        >
          <el-menu-item index="/manage/clubs">
            <i class="el-icon-s-cooperation"></i>
            <span>社团管理</span>
          </el-menu-item>
          <el-menu-item index="/manage/schools">
            <i class="el-icon-school"></i>
            <span>学校管理</span>
          </el-menu-item>
          <el-menu-item index="/manage/users">
            <i class="el-icon-user"></i>
            <span>用户管理</span>
          </el-menu-item>
          <el-menu-item index="/manage/posts">
            <i class="el-icon-document"></i>
            <span>帖子管理</span>
          </el-menu-item>
        </el-menu>
      </div>

      <!-- 主内容区域 -->
      <div class="main-content">
        <router-view></router-view>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import TopBar from '../../components/TopBar.vue';

const route = useRoute();
const activeMenu = computed(() => route.path);
</script>
<style>
body{
  margin: 0;
}
</style>
<style scoped>
.manage-container {
  min-height: 100vh;
  background-color: #121212;
  color: #ffffff;
}

.manage-content {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 10vw;
  background-color: #1f1b24;
  border-right: 1px solid #333333;
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 5;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid #333333;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 18px;
  color: #ffffff;
}

.sidebar-menu {
  border-right: none;
  width: 100%;
}

.main-content {
  flex: 1;
  padding: 20px;
  margin-left: 10vw;
  overflow-y: auto;
}

.el-menu-item {
  display: flex;
  align-items: center;
  height: 56px;
}

.el-menu-item i {
  margin-right: 10px;
  font-size: 18px;
}

</style>